<html>
<head><meta charset="utf-8"><title>HIR-&gt;AbstractConst · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html">HIR-&gt;AbstractConst</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228557258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557258">(Mar 03 2021 at 08:57)</a>:</h4>
<p>So... I'm sure this has come up before, but could we create a HIR-&gt;AbstractConst converter? The rules would be exactly the same as with const evaluatable unchecked. Not sure whether that makes it easier to figure out which where bounds to apply to that constant. Just wanted to know if <span class="user-mention" data-user-id="216206">@lcnr</span> has considered this before and what their thoughts were/are on it</p>



<a name="228557586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557586">(Mar 03 2021 at 09:00)</a>:</h4>
<p>i should stop thinking by myself <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="228557641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557641">(Mar 03 2021 at 09:00)</a>:</h4>
<p>iirc we did talk about potentially using hir instead of mir for this before we started to implement any of this</p>



<a name="228557722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557722">(Mar 03 2021 at 09:01)</a>:</h4>
<p>i think we decided against it back then because hir doesn't know about adjustments</p>



<a name="228557763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557763">(Mar 03 2021 at 09:01)</a>:</h4>
<p>right, but I don't know if we talked about the where bounds situation and whether using the HIR instead of the MIR could potentially solve problems for us</p>



<a name="228557829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557829">(Mar 03 2021 at 09:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst/near/228557586">said</a>:</p>
<blockquote>
<p>i should stop thinking by myself <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>
</blockquote>
<p>yeah, that's there this message comes in ^^</p>



<a name="228557845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557845">(Mar 03 2021 at 09:02)</a>:</h4>
<p>i have an idea which nearly solves the problem <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="228557888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557888">(Mar 03 2021 at 09:03)</a>:</h4>
<p>so we can estimate how a const wf bound looks from its hir</p>



<a name="228557960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228557960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228557960">(Mar 03 2021 at 09:03)</a>:</h4>
<p>which would allow us to start by filtering all unevaluated anon consts in where bounds</p>



<a name="228558098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228558098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228558098">(Mar 03 2021 at 09:04)</a>:</h4>
<p>and then re-add any bounds which can't depend on our current const because they are less complex</p>



<a name="228558195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228558195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228558195">(Mar 03 2021 at 09:05)</a>:</h4>
<p>i can think of two issues here though:</p>



<a name="228558262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228558262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228558262">(Mar 03 2021 at 09:06)</a>:</h4>
<p>concrete constants can depend on <code>u8: Trait&lt;{ complex_concrete_expression }</code> and we can get cycles that way</p>



<a name="228558366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228558366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228558366">(Mar 03 2021 at 09:07)</a>:</h4>
<p>and we currently allow - and want to allow - applying subexpressions of const evaluatable bounds, which means that we can't actually use the fact that an expression is more complex</p>



<a name="228559517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228559517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228559517">(Mar 03 2021 at 09:16)</a>:</h4>
<p>the first issue is </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">f</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">Sized</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">usize</span> <span class="p">{</span><span class="w"> </span><span class="mi">3</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">g</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">Sized</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">usize</span> <span class="p">{</span><span class="w"> </span><span class="mi">4</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">f</span>::<span class="o">&lt;</span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="mi">4</span><span class="p">]</span><span class="o">&gt;</span><span class="p">()]</span>: <span class="nb">Sized</span>
    <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">g</span>::<span class="o">&lt;</span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="mi">3</span><span class="p">]</span><span class="o">&gt;</span><span class="p">()]</span>: <span class="nb">Sized</span>
</code></pre></div>



<a name="228559688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228559688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228559688">(Mar 03 2021 at 09:17)</a>:</h4>
<p>wait, couldn't we filter anon const based on which parameters are pulled in instead?</p>



<a name="228559889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228559889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228559889">(Mar 03 2021 at 09:19)</a>:</h4>
<p>so only add anon consts to our constant if the params they mention are a true subset of what's used by our const?</p>



<a name="228559914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228559914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228559914">(Mar 03 2021 at 09:19)</a>:</h4>
<p>i guess that because the "used" params are an overestimation that might get somewhat weird</p>



<a name="228559970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228559970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228559970">(Mar 03 2021 at 09:20)</a>:</h4>
<p>isn't that the filtering thing that was talked about a week or so ago?</p>



<a name="228559994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228559994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228559994">(Mar 03 2021 at 09:20)</a>:</h4>
<p>yeah, this is about the filtering thing ^^</p>



<a name="228560776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228560776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228560776">(Mar 03 2021 at 09:26)</a>:</h4>
<p>filtering by subsets seems like the right way, as long as there is no way to generate information about a param without mentioning it, but I don't think there is?</p>



<a name="228560979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228560979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228560979">(Mar 03 2021 at 09:28)</a>:</h4>
<p>there is</p>



<a name="228561049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228561049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228561049">(Mar 03 2021 at 09:29)</a>:</h4>
<p>which is why our idea to get the "used subset" of params</p>



<a name="228561082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228561082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228561082">(Mar 03 2021 at 09:29)</a>:</h4>
<p>is to figure out the transitive closure of all predicates mentioning our initial params</p>



<a name="228561220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228561220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228561220">(Mar 03 2021 at 09:30)</a>:</h4>
<p>oh</p>



<a name="228561223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228561223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228561223">(Mar 03 2021 at 09:30)</a>:</h4>
<p>OH</p>



<a name="228561226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228561226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228561226">(Mar 03 2021 at 09:30)</a>:</h4>
<p>now I understand</p>



<a name="228561335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228561335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228561335">(Mar 03 2021 at 09:31)</a>:</h4>
<p>that's easy and obvious to figure out, now I gotta ponder on how exactly that helps <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="228561456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228561456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228561456">(Mar 03 2021 at 09:32)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(const_generics, const_evaluatable_checked)]</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Trait</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">ASSOC</span>: <span class="kt">usize</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nc">Trait</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">T</span>::<span class="n">ASSOC</span><span class="p">]</span>: <span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="228562541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228562541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228562541">(Mar 03 2021 at 09:40)</a>:</h4>
<p>ok... I can't figure it out. Please explain what would happen in this and in the 3/4 case above if we applied the true-subset rule</p>



<a name="228562856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228562856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228562856">(Mar 03 2021 at 09:43)</a>:</h4>
<p>hm, my idea was the following</p>



<a name="228563029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228563029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228563029">(Mar 03 2021 at 09:44)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">V</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">     </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">uses</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="n">and</span><span class="w"> </span><span class="n">U</span><span class="p">]</span>: <span class="nc">Trait</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">     </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">uses</span><span class="w"> </span><span class="n">T</span><span class="p">]</span>: <span class="nc">Trait</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">     </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">uses</span><span class="w"> </span><span class="n">U</span><span class="p">]</span>: <span class="nc">Trait</span><span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
</code></pre></div>



<a name="228563092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228563092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228563092">(Mar 03 2021 at 09:45)</a>:</h4>
<p>or wait, that won't actually work this way</p>



<a name="228563118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228563118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228563118">(Mar 03 2021 at 09:45)</a>:</h4>
<p>because the last predicate</p>



<a name="228563153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228563153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228563153">(Mar 03 2021 at 09:46)</a>:</h4>
<p>actually pulls in both <code>T</code> and <code>V</code> because they are mentioned in a predicate together</p>



<a name="228563356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228563356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228563356">(Mar 03 2021 at 09:47)</a>:</h4>
<p>hmm</p>



<a name="228563376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228563376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228563376">(Mar 03 2021 at 09:48)</a>:</h4>
<p>does <code>[u8; uses U]: Trait&lt;u8&gt;</code> really need to pull in <code>V</code>?</p>



<a name="228563424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228563424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228563424">(Mar 03 2021 at 09:48)</a>:</h4>
<p>seems like we'd never be able to unify any part of the <code>uses U</code> expression with the <code>uses T and U</code> expression</p>



<a name="228563456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228563456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228563456">(Mar 03 2021 at 09:48)</a>:</h4>
<p>so the <code>[u8; _]: Trait&lt;V&gt;</code> predicate wouldn't be needed</p>



<a name="228570562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228570562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228570562">(Mar 03 2021 at 10:38)</a>:</h4>
<p>hmm <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> that might be true, but i don't know how to prove this/implement it in the compiler</p>



<a name="228571250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571250">(Mar 03 2021 at 10:43)</a>:</h4>
<p>wdym by prove it?</p>



<a name="228571267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571267">(Mar 03 2021 at 10:43)</a>:</h4>
<p>like make sure that line of reasoning is correct?</p>



<a name="228571303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571303">(Mar 03 2021 at 10:43)</a>:</h4>
<p>yeah</p>



<a name="228571380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571380">(Mar 03 2021 at 10:44)</a>:</h4>
<p>it feels hard to figure out a precise set of rules where this must always be true</p>



<a name="228571409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571409">(Mar 03 2021 at 10:44)</a>:</h4>
<p>if it helps</p>



<a name="228571423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571423">(Mar 03 2021 at 10:44)</a>:</h4>
<p>const_evaluatable_checked isnt stable</p>



<a name="228571431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571431">(Mar 03 2021 at 10:44)</a>:</h4>
<p>so its not too bad to get it wrong <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="228571454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571454">(Mar 03 2021 at 10:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="326176">Boxy</span> <a href="#narrow/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst/near/228571431">said</a>:</p>
<blockquote>
<p>so its not too bad to get it wrong <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>
</blockquote>
<p>but it's bad to get this subtly wrong ^^</p>



<a name="228571468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571468">(Mar 03 2021 at 10:44)</a>:</h4>
<p>true</p>



<a name="228571475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571475">(Mar 03 2021 at 10:45)</a>:</h4>
<p>if the way we are wrong is subtle enough</p>



<a name="228571481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571481">(Mar 03 2021 at 10:45)</a>:</h4>
<p>although "wrong" here just means that we might fail to compile things</p>



<a name="228571499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571499">(Mar 03 2021 at 10:45)</a>:</h4>
<p>we won't detect this while it is still unstable</p>



<a name="228571504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571504">(Mar 03 2021 at 10:45)</a>:</h4>
<p>rather than compile wrong things</p>



<a name="228571516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/228571516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#228571516">(Mar 03 2021 at 10:45)</a>:</h4>
<p>still bad, cos backwards compat</p>



<a name="229275105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229275105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229275105">(Mar 08 2021 at 10:13)</a>:</h4>
<p>hmm, do we only need to care about <code>explicit_predicates_of</code>? cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="229275201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229275201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229275201">(Mar 08 2021 at 10:14)</a>:</h4>
<p>my idea was to change <code>explicit_predicates_of</code> to <code>raw_explicit_predicates_of</code></p>



<a name="229275268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229275268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229275268">(Mar 08 2021 at 10:15)</a>:</h4>
<p>which doesn't do anything with anon consts and returns <code>ConstKind::Raw(HirId)</code> for the ones we find</p>



<a name="229275321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229275321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229275321">(Mar 08 2021 at 10:15)</a>:</h4>
<p>which we then actually convert to their expected const kind in <code>explicit_predicates_of</code></p>



<a name="229276758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229276758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229276758">(Mar 08 2021 at 10:28)</a>:</h4>
<p>so afaik <code>predicates_defined_on</code> only adds outlives predicates which i think don't matter for our filtering</p>



<a name="229276802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229276802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229276802">(Mar 08 2021 at 10:29)</a>:</h4>
<p>so <code>'b: 'a</code> should not allow us to get to either <code>'b</code> from <code>'a</code> or <code>'a</code> from <code>'b</code>.</p>



<a name="229277028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229277028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229277028">(Mar 08 2021 at 10:30)</a>:</h4>
<p><code>predicates_of</code> adds <code>Self: Trait</code></p>



<a name="229277092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229277092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229277092">(Mar 08 2021 at 10:31)</a>:</h4>
<p>that actually seems needed :/</p>



<a name="229277189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/HIR-%3EAbstractConst/near/229277189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/HIR-.3EAbstractConst.html#229277189">(Mar 08 2021 at 10:32)</a>:</h4>
<p>like... we could duplicate the code adding <code>Self: Trait</code> so that we only have to modify <code>explicit_predicates_of</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>